home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
usenet
/
sources
/
volume91
/
devices
/
sanainov
/
part01
next >
Wrap
Internet Message Format
|
1991-11-16
|
59KB
Path: news.larc.nasa.gov!amiga-request
From: amiga-request@ab20.larc.nasa.gov (Amiga Sources/Binaries Moderator)
Subject: v91i192: SANA-II - the SANA-II Network Device Driver Specification, Part01/04
Reply-To: dlarson@cbmvax.uucp (Dale Larson)
Newsgroups: comp.sources.amiga
Message-ID: <comp.sources.amiga.v91i192@ab20.larc.nasa.gov>
Date: 16 Nov 91 11:10:29 GMT
Approved: tadguy@uunet.UU.NET (Tad Guy)
X-Mail-Submissions-To: amiga@uunet.uu.net
X-Post-Discussions-To: comp.sys.amiga.misc
Submitted-by: dlarson@cbmvax.uucp (Dale Larson)
Posting-number: Volume 91, Issue 192
Archive-name: devices/sana-ii-nov7/part01
[ uuencoded binaries included ...tad ]
The SANA-II Network Device Driver Specification is a standard for the
interface to any Amiga networking hardware. It is a specification for an
Amiga software interface to the data link layer in the ISO 7-Layer Reference
Model of Open Systems Interconnection. All Amiga network hardware vendors
should supply a SANA-II device driver for their hardware. All protocol writers
should talk to SANA-II device drivers rather than to network hardware. Any
protocol stack should work with any SANA-II device driver. The standard has
been kept simple and straight-forward so that SANA-II device drivers should be
easy to write and to use. They should be highly efficient and have low
resource usage. Any SANA-II device driver should behave very much like any
other SANA-II device driver.
Application writers must not use SANA-II Device Drivers directly.
Applications must use the API provided by the network protocol software the
application supports. It is hoped that a standard network API for all Amigas
will be made available by Commodore in the near future.
This version of the standard addresses issues from the original SANA-II
standard which were raised in the 1991 North American and European Amiga
DevCons as well as in the conversion of existing protocols to the use of the
standard. This draft reflects several rounds of comments from active
implementors of SANA-II software. Most of the changes are simplifications and
should be easy to incorporate into any work in progress. The changes should
make the writing and use of SANA-II drivers much easier. Commodore's internal
versions of the A2065 and other drivers and the AS225 software package are
currently compliant with this version of the SANA-II spec.
This version of the specification is very solid and will stand as final unless
comments containing very compelling objections are received by December 31,
1991. All SANA-II device drivers and software utilizing those drivers should
be written to this version of the specification.
Distribution of this version of the standard is unlimited.
This distribution contains the SANA-II Network Device Driver Specification,
version of November 7, 1991, for final comment and approval. This means
that no additional changes are expected and that only compelling objections
will keep this version of the spec from becoming final on January 1, 1991.
This distribution also contains supporting materials in the form of some
example code. More example code, including a skeleton SANA-II device
driver, are planned for the near future.
Finally, so that you can actually use this now to develop network protocols,
a beta binary of our A2065 ethernet driver is included.
FILES
README - this file.
driver.txt - text of driver specification.
sana2driver.doc - autodoc for driver specification.
copybuff.doc - autodoc for buffer management functions in spec.
devs/a2065.device - *beta* version of Commodore ethernet driver.
(also works with Ameristar ethernet boards)
plus include files for the specification in "include/devices"
plus example programs in "examples"
#!/bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 1 (of 4)."
# Contents: copybuff.doc devs examples examples/configure
# examples/configure/configure.c examples/configure/lmkfile
# examples/devquery examples/devquery/devquery.c
# examples/devquery/lmkfile examples/globstats
# examples/globstats/globstats.c examples/globstats/lmkfile
# examples/offline examples/offline/lmkfile
# examples/offline/offline.c examples/online examples/online/lmkfile
# examples/online/online.c examples/readme examples/skeleton
# examples/skeleton/skeleton.c examples/skeleton/skeleton.h
# examples/typestats examples/typestats/lmkfile
# examples/typestats/typestats.c examples/waitforonline
# examples/waitforonline/lmkfile
# examples/waitforonline/waitforonline.c include include/devices
# include/devices/sana2.h include/devices/sana2.i
# include/devices/sana2specialstats.h
# include/devices/sana2specialstats.i readme
# Wrapped by tadguy@ab20 on Fri Nov 15 14:11:14 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'copybuff.doc' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'copybuff.doc'\"
else
echo shar: Extracting \"'copybuff.doc'\" \(2995 characters\)
sed "s/^X//" >'copybuff.doc' <<'END_OF_FILE'
XTABLE OF CONTENTS
X
Xany_sana2_protocol/CopyFromBuff
Xany_sana2_protocol/CopyToBuff
Xany_sana2_protocol/CopyFromBuff any_sana2_protocol/CopyFromBuff
X
X NAME
X CopyFromBuff -- Copy n bytes from an abstract data structure.
X
X SYNOPSIS
X success = CopyFromBuff(to, from, n)
X d0 a0 a1 d0
X
X BOOL CopyToBuff(VOID *, VOID *, LONG);
X
X FUNCTION
X This function copies 'n' bytes of data in the abstract data structure
X pointed to by 'from' into the contigous memory pointed to by 'to'.
X 'to' must contain at least 'n' bytes of usable memory or innocent
X memory will be overwritten.
X
X INPUTS
X to - pointer to contiguous memory to copy to.
X n - number of bytes to copy.
X from - pointer to abstract structure to copy to.
X
X RESULT
X success - TRUE if operation was successful, else FALSE.
X
X EXAMPLE
X
X NOTES
X This function must be callable from interupts. In particular, this
X means that this function may not directly or indirectly call any
X system memory functions (since those functions rely on Forbid() to
X protect themselves) and that you must not compile this function
X with stack checking enabled. See the RKM:Libraries Exec:Interupts
X chapter for more details on what is legal in a routine called from
X an interupt handler.
X
X 'C' programmers should not compile with stack checking (option '-v'
X in SAS) and should geta4() or __saveds.
X
X BUGS
X
X SEE ALSO
X
Xany_sana2_protocol/CopyToBuff any_sana2_protocol/CopyToBuff
X
X NAME
X CopyToBuff -- Copy n bytes to an abstract data structure.
X
X SYNOPSIS
X success = CopyToBuff(to, from, n)
X d0 a0 a1 d0
X
X BOOL CopyToBuff(VOID *, VOID *, LONG);
X
X FUNCTION
X This function first does any initialization and/or allocation
X required to prepare the abstract data structure pointed at by 'to'
X to be filled with 'n' bytes of data from 'from'. It then executes
X the copy operation.
X
X If, for example, there is not enough memory available to prepare
X the abstract data structure, the call is failed and FALSE is returned.
X
X The buffer management scheme should be such that any memory needed
X to fulfill CopyToBuff() calls is already allocated from the system
X before the call to CopyToBuff() is made.
X
X INPUTS
X from - pointer to contiguous memory to copy from.
X n - number of bytes to copy.
X to - pointer to abstract structure to copy to.
X
X RESULT
X success - TRUE if operation was successful, else FALSE.
X
X EXAMPLE
X
X NOTES
X This function must be callable from interupts. In particular, this
X means that this function may not directly or indirectly call any
X system memory functions (since those functions rely on Forbid() to
X protect themselves) and that you must not compile this function
X with stack checking enabled. See the RKM:Libraries Exec:Interupts
X chapter for more details on what is legal in a routine called from
X an interupt handler.
X
X 'C' programmers should not compile with stack checking (option '-v'
X in SAS) and should geta4() or __saveds.
X
X BUGS
X
X SEE ALSO
X
X
END_OF_FILE
if test 2995 -ne `wc -c <'copybuff.doc'`; then
echo shar: \"'copybuff.doc'\" unpacked with wrong size!
fi
# end of 'copybuff.doc'
fi
if test ! -d 'devs' ; then
echo shar: Creating directory \"'devs'\"
mkdir 'devs'
fi
if test ! -d 'examples' ; then
echo shar: Creating directory \"'examples'\"
mkdir 'examples'
fi
if test ! -d 'examples/configure' ; then
echo shar: Creating directory \"'examples/configure'\"
mkdir 'examples/configure'
fi
if test -f 'examples/configure/configure.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'examples/configure/configure.c'\"
else
echo shar: Extracting \"'examples/configure/configure.c'\" \(3800 characters\)
sed "s/^X//" >'examples/configure/configure.c' <<'END_OF_FILE'
X/*
X** $Id: configure.c,v 1.2 91/11/12 16:23:41 dlarson Exp Locker: dlarson $
X**
X** SANA-II driver configuration example.
X**
X** Copyright 1991 Commodore-Amiga, Inc.
X**
X** This code may be modified and used freely on Amiga computers.
X**
X**
X** This example is pretty ugly and should be cleaned up. Sorry.
X** Still, you should be able to see the proper steps to take
X** in configuring a SANA-II device.
X*/
X
X#define NOBUFFS
X#include "/skeleton/skeleton.h"
X
Xstruct MsgPort *DevPort = NULL;
Xstruct IOSana2Req *IOB1 = NULL;
X
Xint DeviceOpen = 0;
Xlong DevBits;
Xint NumBytes;
X
Xvoid DoConfig(UBYTE *Address);
Xvoid DoGetAddr(void);
Xvoid DoQuery(struct Sana2DeviceQuery *q);
Xvoid DoPrintAddr(void);
X
X
Xmain(int argc, char *argv[])
X{
Xint i;
Xlong temp;
Xstruct Sana2DeviceQuery Query;
X
X if(!initdev())
X {
X printf("Open Failed.\n");
X goto bottom;
X }
X printf("About to Query the device.\n");
X Query.SizeAvailable = sizeof(Query);
X DoQuery(&Query);
X if(IOB1->ios2_Req.io_Error)
X {
X printf("ERROR RETURNED: %ld\n", (long)IOB1->ios2_Req.io_Error);
X goto bottom;
X }
X if(Query.AddrFieldSize%8 != 0 || Query.AddrFieldSize == 0)
X {
X printf("Oh, no! There really is funny hardware in the world!\n"
X "Address field is %d bits. This example needs to be\n"
X "updated to understand address fields with a number of\n"
X "bits not divisible by eight.\n", Query.AddrFieldSize);
X goto bottom;
X }
X NumBytes = Query.AddrFieldSize/8;
X if(argc>1)
X {
X for(i=0; i<NumBytes; i++)
X {
X sscanf(argv[1]+(i*3), "%lx", &temp);
X IOB1->ios2_SrcAddr[i] = (char)temp;
X }
X }else
X {
X printf("\nNo user address, getting ROM address.\n");
X DoGetAddr();
X if (IOB1->ios2_Req.io_Error)
X {
X printf("ERROR RETURNED: 0x%lx\n",
X (long)IOB1->ios2_Req.io_Error);
X goto bottom;
X }
X }
X printf("SrcAddr is one we're going to attempt to configure with:\n");
X DoPrintAddr();
X printf("Attempting to set address\n");
X DoConfig(IOB1->ios2_SrcAddr);
X if(IOB1->ios2_Req.io_Error)
X {
X if(IOB1->ios2_Req.io_Error == S2ERR_BAD_STATE &&
X IOB1->ios2_WireError == S2WERR_IS_CONFIGURED)
X printf("Pardon Me. I'm Already Configured!\n");
X else
X printf("ERROR CODE:%ld WERR:%ld\n",
X (long)IOB1->ios2_Req.io_Error,
X (long)IOB1->ios2_WireError);
X } else
X {
X printf("Configured. Results (SrcAddr is the address actually config'd to):\n");
X DoPrintAddr();
X printf("S2_GETSTATIONADDRESS and results (Src=Current Dst=Default):\n");
X DoGetAddr(); /* really should check for an error, device could be offline, for example */
X DoPrintAddr();
X }
Xbottom: closedev();
X}
X
X
Xvoid DoConfig(UBYTE *Address)
X{
Xregister UBYTE *p = IOB1->ios2_SrcAddr;
Xregister i;
X
X IOB1->ios2_Req.io_Error = 0;
X IOB1->ios2_Req.io_Flags = IOF_QUICK;
X IOB1->ios2_Req.io_Command = S2_CONFIGINTERFACE;
X for(i = 0; i < NumBytes; i++)
X *(p++) = *(Address++);
X DoIO((struct IORequest *)IOB1);
X}
X
X
Xvoid DoQuery(struct Sana2DeviceQuery *q)
X{
X
X IOB1->ios2_Req.io_Error = 0;
X IOB1->ios2_Req.io_Flags = IOF_QUICK;
X IOB1->ios2_Req.io_Command = S2_DEVICEQUERY;
X IOB1->ios2_StatData = q;
X DoIO((struct IORequest *)IOB1);
X IOB1->ios2_StatData = NULL;
X}
X
X
Xvoid DoGetAddr(void)
X{
X
X IOB1->ios2_Req.io_Error = 0;
X IOB1->ios2_Req.io_Flags = IOF_QUICK;
X IOB1->ios2_Req.io_Command = S2_GETSTATIONADDRESS;
X DoIO((struct IORequest *)IOB1);
X}
X
Xvoid DoPrintAddr(void)
X{
Xregister i;
X
X printf("SrcAddr: ");
X for (i = 0; i < NumBytes; i++)
X printf("%02x ", (long)(IOB1->ios2_SrcAddr[i] & 0xFF)) ;
X printf("\nDstAddr: ");
X for (i = 0; i < NumBytes; i++)
X printf("%02x ", (long)(IOB1->ios2_DstAddr[i] & 0xFF)) ;
X printf("\n");
X}
X
END_OF_FILE
if test 3800 -ne `wc -c <'examples/configure/configure.c'`; then
echo shar: \"'examples/configure/configure.c'\" unpacked with wrong size!
fi
# end of 'examples/configure/configure.c'
fi
if test -f 'examples/configure/lmkfile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'examples/configure/lmkfile'\"
else
echo shar: Extracting \"'examples/configure/lmkfile'\" \(258 characters\)
sed "s/^X//" >'examples/configure/lmkfile' <<'END_OF_FILE'
XINCFLAGS = -isana2:include
XCLIB = lib:lc.lib lib:amiga.lib lib:debug.lib
X
Xall: configure
X
Xconfigure: configure.o /skeleton/skeleton.o
X blink FROM lib:c.o $@.o /skeleton/skeleton.o TO $@ LIB $(CLIB)
X
X#NO STACK CHECKING!!!
X.c.o:
X lc $(INCFLAGS) -v -csuq $*
X
END_OF_FILE
if test 258 -ne `wc -c <'examples/configure/lmkfile'`; then
echo shar: \"'examples/configure/lmkfile'\" unpacked with wrong size!
fi
# end of 'examples/configure/lmkfile'
fi
if test ! -d 'examples/devquery' ; then
echo shar: Creating directory \"'examples/devquery'\"
mkdir 'examples/devquery'
fi
if test -f 'examples/devquery/devquery.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'examples/devquery/devquery.c'\"
else
echo shar: Extracting \"'examples/devquery/devquery.c'\" \(1546 characters\)
sed "s/^X//" >'examples/devquery/devquery.c' <<'END_OF_FILE'
X/*
X** $Id: devquery.c,v 1.1 91/11/13 11:07:16 dlarson Exp $
X**
X** SANA-II driver device query example.
X**
X** Copyright 1991 Commodore-Amiga, Inc.
X**
X** This code may be modified and used freely on Amiga computers.
X**
X*/
X
X#define NOBUFFS
X#include "/skeleton/skeleton.h"
X
Xstruct MsgPort *DevPort = NULL;
Xstruct IOSana2Req *IOB1 = NULL;
X
Xint DeviceOpen = 0;
Xlong DevBits;
X
X
Xmain(int argc, char *argv[])
X{
Xstruct Sana2DeviceQuery query;
X
X if(!initdev())
X {
X printf("Open Failed\n");
X goto bottom;
X }
X printf("About to Query the device.\n");
X query.SizeAvailable = sizeof(query);
X IOB1->ios2_Req.io_Error = 0;
X IOB1->ios2_Req.io_Flags = IOF_QUICK;
X IOB1->ios2_Req.io_Command = S2_DEVICEQUERY;
X IOB1->ios2_StatData = &query;
X DoIO((struct IORequest *)IOB1);
X IOB1->ios2_StatData = NULL;
X if(IOB1->ios2_Req.io_Error)
X {
X printf("ERROR RETURNED:%ld WERR:%ld\n",
X (long)IOB1->ios2_Req.io_Error,
X (long)IOB1->ios2_WireError);
X goto bottom;
X }
X printf("Query results:\n");
X printf("Size available:%ld Size Supplied:%ld DevQueryFormat:%ld\n",
X query.SizeAvailable, query.SizeSupplied, query.DevQueryFormat);
X printf("DeviceLevel:%ld\n", query.DeviceLevel);
X printf("Number of bits in address:%ld\n", (long)query.AddrFieldSize);
X printf("Maximum Transmition Unit: %ld\n", query.MTU);
X printf("Bits Per Second: %ld\n", query.BPS);
X printf("HardwareType: %ld\n", query.HardwareType);
Xbottom: closedev();
X}
END_OF_FILE
if test 1546 -ne `wc -c <'examples/devquery/devquery.c'`; then
echo shar: \"'examples/devquery/devquery.c'\" unpacked with wrong size!
fi
# end of 'examples/devquery/devquery.c'
fi
if test -f 'examples/devquery/lmkfile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'examples/devquery/lmkfile'\"
else
echo shar: Extracting \"'examples/devquery/lmkfile'\" \(255 characters\)
sed "s/^X//" >'examples/devquery/lmkfile' <<'END_OF_FILE'
XINCFLAGS = -isana2:include
XCLIB = lib:lc.lib lib:amiga.lib lib:debug.lib
X
Xall: devquery
X
Xdevquery: devquery.o /skeleton/skeleton.o
X blink FROM lib:c.o $@.o /skeleton/skeleton.o TO $@ LIB $(CLIB)
X
X#NO STACK CHECKING!!!
X.c.o:
X lc $(INCFLAGS) -v -csuq $*
X
END_OF_FILE
if test 255 -ne `wc -c <'examples/devquery/lmkfile'`; then
echo shar: \"'examples/devquery/lmkfile'\" unpacked with wrong size!
fi
# end of 'examples/devquery/lmkfile'
fi
if test ! -d 'examples/globstats' ; then
echo shar: Creating directory \"'examples/globstats'\"
mkdir 'examples/globstats'
fi
if test -f 'examples/globstats/globstats.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'examples/globstats/globstats.c'\"
else
echo shar: Extracting \"'examples/globstats/globstats.c'\" \(1370 characters\)
sed "s/^X//" >'examples/globstats/globstats.c' <<'END_OF_FILE'
X/*
X** $Id: globstats.c,v 1.4 91/11/13 11:18:52 dlarson Exp $
X**
X** SANA-II driver utility -- Print statistics for device.
X**
X** Copyright 1991 Commodore-Amiga, Inc.
X**
X** This code may be modified and used freely on Amiga computers.
X**
X*/
X
X
X#define NOBUFFS 1
X#include "/skeleton/skeleton.h"
X
Xstruct MsgPort *DevPort = NULL;
Xstruct IOSana2Req *IOB1 = NULL;
Xstruct Sana2DeviceStats Stats;
X
Xint DeviceOpen = 0;
Xlong DevBits;
X
Xvoid PrintStats(void);
Xvoid GetGlobalStats(void);
X
X
Xmain(argc , argv)
Xchar *argv[];
X{
X if(!initdev())
X printf("Open Failed.\n");
X else
X {
X GetGlobalStats();
X if (!IOB1->ios2_Req.io_Error)
X PrintStats();
X else
X printf("Error Returned: %ld WireError: %ld\n" , IOB1->ios2_Req.io_Error , IOB1->ios2_WireError);
X }
Xbottom: closedev();
X return(0);
X}
X
Xvoid GetGlobalStats(void)
X{
X IOB1->ios2_Req.io_Error = 0;
X IOB1->ios2_Req.io_Flags = IOF_QUICK;
X IOB1->ios2_Req.io_Command = S2_GETGLOBALSTATS;
X IOB1->ios2_StatData = &Stats;
X DoIO(IOB1);
X}
X
Xvoid PrintStats(void)
X{
X printf("Packets Received: %d\n" , Stats.PacketsReceived);
X printf("Packets Transmitted: %d\n" , Stats.PacketsSent);
X printf("CRC Errors: %d\n" , Stats.BadData);
X printf("Unknown Packets: %d\n" , Stats.UnknownTypesReceived);
X printf("Fifo Overruns: %d\n" , Stats.Overruns);
X printf("Reconfigurations: %d\n" , Stats.Reconfigurations);
X}
END_OF_FILE
if test 1370 -ne `wc -c <'examples/globstats/globstats.c'`; then
echo shar: \"'examples/globstats/globstats.c'\" unpacked with wrong size!
fi
# end of 'examples/globstats/globstats.c'
fi
if test -f 'examples/globstats/lmkfile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'examples/globstats/lmkfile'\"
else
echo shar: Extracting \"'examples/globstats/lmkfile'\" \(258 characters\)
sed "s/^X//" >'examples/globstats/lmkfile' <<'END_OF_FILE'
XINCFLAGS = -isana2:include
XCLIB = lib:lc.lib lib:amiga.lib lib:debug.lib
X
Xall: globstats
X
Xglobstats: globstats.o /skeleton/skeleton.o
X blink FROM lib:c.o $@.o /skeleton/skeleton.o TO $@ LIB $(CLIB)
X
X#NO STACK CHECKING!!!
X.c.o:
X lc $(INCFLAGS) -v -csuq $*
X
END_OF_FILE
if test 258 -ne `wc -c <'examples/globstats/lmkfile'`; then
echo shar: \"'examples/globstats/lmkfile'\" unpacked with wrong size!
fi
# end of 'examples/globstats/lmkfile'
fi
if test ! -d 'examples/offline' ; then
echo shar: Creating directory \"'examples/offline'\"
mkdir 'examples/offline'
fi
if test -f 'examples/offline/lmkfile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'examples/offline/lmkfile'\"
else
echo shar: Extracting \"'examples/offline/lmkfile'\" \(253 characters\)
sed "s/^X//" >'examples/offline/lmkfile' <<'END_OF_FILE'
XINCFLAGS = -isana2:include
XCLIB = lib:lc.lib lib:amiga.lib lib:debug.lib
X
Xall: offline
X
Xoffline: offline.o /skeleton/skeleton.o
X blink FROM lib:c.o $@.o /skeleton/skeleton.o TO $@ LIB $(CLIB)
X
X
X#NO STACK CHECKING!!!
X.c.o:
X lc $(INCFLAGS) -v -csuq $*
X
END_OF_FILE
if test 253 -ne `wc -c <'examples/offline/lmkfile'`; then
echo shar: \"'examples/offline/lmkfile'\" unpacked with wrong size!
fi
# end of 'examples/offline/lmkfile'
fi
if test -f 'examples/offline/offline.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'examples/offline/offline.c'\"
else
echo shar: Extracting \"'examples/offline/offline.c'\" \(919 characters\)
sed "s/^X//" >'examples/offline/offline.c' <<'END_OF_FILE'
X/*
X** $Id: offline.c,v 1.4 91/11/13 11:12:08 dlarson Exp $
X**
X** SANA-II driver utility -- Make online driver go offline.
X**
X** Copyright 1991 Commodore-Amiga, Inc.
X**
X** This code may be modified and used freely on Amiga computers.
X**
X*/
X
X
X#define NOBUFFS
X#include "/skeleton/skeleton.h"
X
Xstruct MsgPort *DevPort = NULL;
Xstruct IOSana2Req *IOB1 = NULL;
X
Xint DeviceOpen = 0;
Xlong DevBits;
X
Xvoid DoOffLine();
X
X
Xmain(argc , argv)
Xchar *argv[];
X{
X if (!initdev())
X printf("Open Failed\n");
X else
X {
X printf("Attempting To Go OffLine\n");
X DoOffLine();
X if (IOB1->ios2_Req.io_Error)
X printf("Error: %ld WireError: %ld\n",
X (long)IOB1->ios2_Req.io_Error,
X IOB1->ios2_WireError);
X else
X printf("No Error\n");
X
X }
Xbottom: closedev();
X}
X
X
Xvoid DoOffLine()
X{
X IOB1->ios2_Req.io_Error = 0;
X IOB1->ios2_Req.io_Flags = IOF_QUICK;
X IOB1->ios2_Req.io_Command = S2_OFFLINE;
X DoIO(IOB1);
X}
END_OF_FILE
if test 919 -ne `wc -c <'examples/offline/offline.c'`; then
echo shar: \"'examples/offline/offline.c'\" unpacked with wrong size!
fi
# end of 'examples/offline/offline.c'
fi
if test ! -d 'examples/online' ; then
echo shar: Creating directory \"'examples/online'\"
mkdir 'examples/online'
fi
if test -f 'examples/online/lmkfile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'examples/online/lmkfile'\"
else
echo shar: Extracting \"'examples/online/lmkfile'\" \(250 characters\)
sed "s/^X//" >'examples/online/lmkfile' <<'END_OF_FILE'
XINCFLAGS = -isana2:include
XCLIB = lib:lc.lib lib:amiga.lib lib:debug.lib
X
Xall: online
X
Xonline: online.o /skeleton/skeleton.o
X blink FROM lib:c.o $@.o /skeleton/skeleton.o TO $@ LIB $(CLIB)
X
X
X#NO STACK CHECKING!!!
X.c.o:
X lc $(INCFLAGS) -v -csuq $*
X
END_OF_FILE
if test 250 -ne `wc -c <'examples/online/lmkfile'`; then
echo shar: \"'examples/online/lmkfile'\" unpacked with wrong size!
fi
# end of 'examples/online/lmkfile'
fi
if test -f 'examples/online/online.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'examples/online/online.c'\"
else
echo shar: Extracting \"'examples/online/online.c'\" \(899 characters\)
sed "s/^X//" >'examples/online/online.c' <<'END_OF_FILE'
X/*
X** $Id: online.c,v 1.4 91/11/13 11:10:51 dlarson Exp $
X**
X** SANA-II driver utility -- Make offline driver come online.
X**
X** Copyright 1991 Commodore-Amiga, Inc.
X**
X** This code may be modified and used freely on Amiga computers.
X**
X*/
X
X#define NOBUFFS
X#include "/skeleton/skeleton.h"
X
Xstruct MsgPort *DevPort = NULL;
Xstruct IOSana2Req *IOB1 = NULL;
X
Xint DeviceOpen = 0;
Xlong DevBits;
X
Xvoid DoOnLine();
X
X
Xmain(argc , argv)
Xchar *argv[];
X{
X if(!initdev())
X printf("Open Failed\n");
X else
X {
X printf("Attempting To Go OnLine\n");
X DoOnLine();
X if(IOB1->ios2_Req.io_Error)
X printf("Error: %ld WireError: %ld\n",
X (long)IOB1->ios2_Req.io_Error,
X IOB1->ios2_WireError);
X else
X printf("No Error\n");
X
X }
Xbottom: closedev();
X}
X
Xvoid DoOnLine()
X{
X IOB1->ios2_Req.io_Error = 0;
X IOB1->ios2_Req.io_Flags = IOF_QUICK;
X IOB1->ios2_Req.io_Command = S2_ONLINE;
X DoIO(IOB1);
X}
END_OF_FILE
if test 899 -ne `wc -c <'examples/online/online.c'`; then
echo shar: \"'examples/online/online.c'\" unpacked with wrong size!
fi
# end of 'examples/online/online.c'
fi
if test -f 'examples/readme' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'examples/readme'\"
else
echo shar: Extracting \"'examples/readme'\" \(2190 characters\)
sed "s/^X//" >'examples/readme' <<'END_OF_FILE'
X$Id: readme,v 1.3 91/11/13 10:09:29 dlarson Exp $
X
XThese are utilties for use with SANA-II drivers. Some may be useful to
Xadvanced end-users (with some additional work) but all should be useful to
XSANA-II developers. The source code to these utilities should provide good
Xexamples of how to use much of the functionality within the standard, and the
Xbehavior of the utilities should help to test new driver implementations.
X
XMost of the utilities take advantage of skeleton.c and skeleton.h which
Xinclude functions for opening and closing a SANA-II device. Notably, these
Xfunctions read the device to open and the unit number to open from the
Xenvironment variables SANA.Device and SANA.Unit if those enviroment variables
Xexist, else the user is queried.
X
XNone of the utilities are optimized in any way and all could be made much
Xsmaller, but they probably do not warrant any time for any optimizations, at
Xleast not at this time.
X
XIf any of these are ever made into end-user utilities, they should be Amigaized
X(readargs, no printf(), more reasonable version
Xnumbers, etc. As it is, they are tiny and source would be included in any
Xdistribution anyway. (OK, maybe that's still not a good excuse.)
X
Xdevquery -- gives information about the device.
X
Xconfigure -- configure a SANA-II device. This can only be succesfully done
Xonce, but must be done before the SANA-II device is used for anything other
Xthan devquery. This program accepts as an argument a user-override for the
Xhardware address (though not all devices will respond to this "override").
X
Xglobstats -- print global statistics from the SANA-II device.
X
Xtypestats -- ask SANA-II device to keep statistics on a particular type of
Xpacket and print said statistics gathered by the device. It defaults to
Xgathering ten seconds of statistics, but a command line argument may change
Xthis default.
X
Xwaitforonline -- wait until a SANA-II device comes online. Really just for
Xtesting this functionality in a driver.
X
Xonline -- put an offline SANA-II device online. Really just for
Xtesting this functionality in a driver.
X
Xoffline -- put an online SANA-II device offline. Really just for
Xtesting this functionality in a driver.
X
END_OF_FILE
if test 2190 -ne `wc -c <'examples/readme'`; then
echo shar: \"'examples/readme'\" unpacked with wrong size!
fi
# end of 'examples/readme'
fi
if test ! -d 'examples/skeleton' ; then
echo shar: Creating directory \"'examples/skeleton'\"
mkdir 'examples/skeleton'
fi
if test -f 'examples/skeleton/skeleton.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'examples/skeleton/skeleton.c'\"
else
echo shar: Extracting \"'examples/skeleton/skeleton.c'\" \(1472 characters\)
sed "s/^X//" >'examples/skeleton/skeleton.c' <<'END_OF_FILE'
X/*
X** $Id: skeleton.c,v 1.2 91/11/08 10:47:58 dlarson Exp $
X**
X** SANA-II driver utility skeleton functions.
X**
X** Copyright 1991 Commodore-Amiga, Inc.
X**
X** This code may be modified and used freely on Amiga computers.
X**
X*/
X
X
X#include "skeleton.h"
X
Xint initdev(void)
X{
Xchar device[80];
Xchar buff[80];
XLONG unit;
Xstruct TagItem MyTags[2];
X
X printf("Device name to open: ");
X if(GetVar("SANA2.Device", device, 80, 0) == -1)
X scanf("%s", device);
X else
X printf("%s\n", device);
X printf("Unit number to open: ");
X if(GetVar("SANA2.Unit", buff, 80, 0) == -1)
X scanf("%d", &unit);
X else
X {
X sscanf(buff, "%ld", &unit);
X printf("%ld\n", unit);
X }
X printf("\n");
X
X if ( !(DevPort = CreateMsgPort()) )
X {
X printf("Could not allocate port.\n");
X return(0);
X }
X
X if (!(IOB1 = CreateIORequest(DevPort, sizeof(struct IOSana2Req))))
X {
X printf("Could not allocate extio block.\n");
X return(0);
X }
X
X MyTags[0].ti_Tag = S2_CopyToBuff;
X MyTags[0].ti_Data = (ULONG) CopyToBuff;
X MyTags[1].ti_Tag = S2_CopyFromBuff;
X MyTags[1].ti_Data = (ULONG) CopyFromBuff;
X IOB1->ios2_BufferManagement = MyTags;
X
X if (OpenDevice(device, unit, IOB1, 0))
X {
X printf("Could not open device.\n");
X return(0);
X }
X
X DeviceOpen = 1;
X DevBits = 1L << DevPort->mp_SigBit;
X return(1);
X}
X
X
Xvoid closedev(void)
X{
X if(DeviceOpen)
X {
X printf("\nAttempting To Close Unit.\n");
X CloseDevice(IOB1);
X printf("Closed.\n");
X }
X if(IOB1)
X DeleteIORequest(IOB1);
X if(DevPort)
X DeleteMsgPort(DevPort);
X}
END_OF_FILE
if test 1472 -ne `wc -c <'examples/skeleton/skeleton.c'`; then
echo shar: \"'examples/skeleton/skeleton.c'\" unpacked with wrong size!
fi
# end of 'examples/skeleton/skeleton.c'
fi
if test -f 'examples/skeleton/skeleton.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'examples/skeleton/skeleton.h'\"
else
echo shar: Extracting \"'examples/skeleton/skeleton.h'\" \(954 characters\)
sed "s/^X//" >'examples/skeleton/skeleton.h' <<'END_OF_FILE'
X/*
X** $Id: skeleton.h,v 1.1 91/10/29 11:51:20 dlarson Exp $
X**
X** SANA-II driver utility skeleton header.
X**
X** Copyright 1991 Commodore-Amiga, Inc.
X**
X** This code may be modified and used freely on Amiga computers.
X**
X*/
X
X#include <exec/types.h>
X#include <exec/libraries.h>
X#include <exec/memory.h>
X#include <libraries/dos.h>
X#include <pragmas/exec_pragmas.h>
X#include <clib/exec_protos.h>
X#include <devices/sana2.h>
X
X/*
X** globals
X*/
Xextern struct Library *SysBase;
Xextern struct MsgPort *DevPort;
Xextern struct IOSana2Req *IOB1;
Xextern int DeviceOpen;
Xextern long DevBits;
X/*
X** prototypes
X*/
Xint initdev(void);
Xvoid closedev(void);
XBOOL CopyToBuff(VOID *in, VOID *out, LONG n);
XBOOL CopyFromBuff(VOID *in, VOID *out, LONG n);
X
X/*
X** To make life easy on non-sending/receiving utilities
X*/
X#ifdef NOBUFFS
XBOOL CopyToBuff(void *foo, void *bar, long n){return(FALSE);}
XBOOL CopyFromBuff(void *foo, void *bar, long n){return(FALSE);}
X#endif
END_OF_FILE
if test 954 -ne `wc -c <'examples/skeleton/skeleton.h'`; then
echo shar: \"'examples/skeleton/skeleton.h'\" unpacked with wrong size!
fi
# end of 'examples/skeleton/skeleton.h'
fi
if test ! -d 'examples/typestats' ; then
echo shar: Creating directory \"'examples/typestats'\"
mkdir 'examples/typestats'
fi
if test -f 'examples/typestats/lmkfile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'examples/typestats/lmkfile'\"
else
echo shar: Extracting \"'examples/typestats/lmkfile'\" \(259 characters\)
sed "s/^X//" >'examples/typestats/lmkfile' <<'END_OF_FILE'
XINCFLAGS = -isana2:include
XCLIB = lib:lc.lib lib:amiga.lib lib:debug.lib
X
Xall: typestats
X
Xtypestats: typestats.o /skeleton/skeleton.o
X blink FROM lib:c.o $@.o /skeleton/skeleton.o TO $@ LIB $(CLIB)
X
X
X#NO STACK CHECKING!!!
X.c.o:
X lc $(INCFLAGS) -v -csuq $*
X
END_OF_FILE
if test 259 -ne `wc -c <'examples/typestats/lmkfile'`; then
echo shar: \"'examples/typestats/lmkfile'\" unpacked with wrong size!
fi
# end of 'examples/typestats/lmkfile'
fi
if test -f 'examples/typestats/typestats.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'examples/typestats/typestats.c'\"
else
echo shar: Extracting \"'examples/typestats/typestats.c'\" \(2450 characters\)
sed "s/^X//" >'examples/typestats/typestats.c' <<'END_OF_FILE'
X/*
X** $Id: typestats.c,v 1.5 91/11/13 11:17:08 dlarson Exp $
X**
X** SANA-II driver utility -- Gather and print stats for one type of packet.
X** (Over a specified period of time.)
X**
X** Copyright 1991 Commodore-Amiga, Inc.
X**
X** This code may be modified and used freely on Amiga computers.
X**
X*/
X
X#define NOBUFFS 1
X#include "/skeleton/skeleton.h"
X#include <stdio.h>
X
Xstruct MsgPort *DevPort = NULL;
Xstruct IOSana2Req *IOB1 = NULL;
Xstruct Sana2PacketTypeStats Stats;
X
Xint DeviceOpen = 0;
Xlong DevBits;
X
XUSHORT PacketType = 0x6003;
X
Xvoid GetTypeStats();
Xvoid PrintStats();
X
X
Xmain(argc , argv)
Xchar *argv[];
X{
Xint ticks = 500;
X
X if(!initdev())
X {
X printf("Open Failed\n");
X goto bottom;
X }
X if (argc > 1)
X PacketType = atoi(argv[1]);
X if (argc > 2)
X ticks = atoi(argv[2]);
X printf("Tracking Packet Type: 0x%lx\n" , PacketType);
X IOB1->ios2_PacketType = PacketType;
X if (TrackType())
X {
X printf("could not track type: 0x%lx\n" , PacketType);
X goto bottom;
X }
X printf("Waiting for %ld seconds.\n\n", ticks/50);
X Delay(ticks);
X GetTypeStats();
X if (!IOB1->ios2_Req.io_Error)
X PrintStats();
X else
X printf("Error Returned: %ld WireError: %ld\n" , IOB1->ios2_Req.io_Error , IOB1->ios2_WireError);
Xbottom: UnTrackType();
X closedev();
X}
X
XTrackType()
X{
X IOB1->ios2_Req.io_Error = 0;
X IOB1->ios2_Req.io_Flags = IOF_QUICK;
X IOB1->ios2_Req.io_Command = S2_TRACKTYPE;
X DoIO(IOB1);
X if (IOB1->ios2_Req.io_Error) {
X printf("TRACKTYPE Error: %ld WireError: %ld\n" , (long) IOB1->ios2_Req.io_Error , IOB1->ios2_WireError);
X return(1);
X }
X return(0);
X}
X
XUnTrackType()
X{
X IOB1->ios2_Req.io_Error = 0;
X IOB1->ios2_Req.io_Flags = IOF_QUICK;
X IOB1->ios2_Req.io_Command = S2_UNTRACKTYPE;
X DoIO(IOB1);
X if (IOB1->ios2_Req.io_Error) {
X printf("UNTRACKTYPE Error: %ld WireError: %ld\n" , (long) IOB1->ios2_Req.io_Error , IOB1->ios2_WireError);
X return(1);
X }
X return(0);
X}
X
Xvoid GetTypeStats()
X{
X IOB1->ios2_Req.io_Error = 0;
X IOB1->ios2_Req.io_Flags = IOF_QUICK;
X IOB1->ios2_Req.io_Command = S2_GETTYPESTATS;
X IOB1->ios2_StatData = &Stats;
X DoIO(IOB1);
X}
X
Xvoid PrintStats()
X{
X printf("Packet Type: 0x%lx\n", (long) PacketType);
X printf("Packets Received: %d\n" , Stats.PacketsReceived);
X printf("Packets Transmitted: %d\n" , Stats.PacketsSent);
X printf("Bytes Received: %d\n" , Stats.BytesReceived);
X printf("Bytes Transmitted: %d\n" , Stats.BytesSent);
X printf("Packets Dropped: %d\n" , Stats.PacketsDropped);
X}
END_OF_FILE
if test 2450 -ne `wc -c <'examples/typestats/typestats.c'`; then
echo shar: \"'examples/typestats/typestats.c'\" unpacked with wrong size!
fi
# end of 'examples/typestats/typestats.c'
fi
if test ! -d 'examples/waitforonline' ; then
echo shar: Creating directory \"'examples/waitforonline'\"
mkdir 'examples/waitforonline'
fi
if test -f 'examples/waitforonline/lmkfile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'examples/waitforonline/lmkfile'\"
else
echo shar: Extracting \"'examples/waitforonline/lmkfile'\" \(271 characters\)
sed "s/^X//" >'examples/waitforonline/lmkfile' <<'END_OF_FILE'
XINCFLAGS = -isana2:include
XCLIB = lib:lc.lib lib:amiga.lib lib:debug.lib
X
Xall: waitforonline
X
Xwaitforonline: waitforonline.o /skeleton/skeleton.o
X blink FROM lib:c.o $@.o /skeleton/skeleton.o TO $@ LIB $(CLIB)
X
X
X#NO STACK CHECKING!!!
X.c.o:
X lc $(INCFLAGS) -v -csuq $*
X
END_OF_FILE
if test 271 -ne `wc -c <'examples/waitforonline/lmkfile'`; then
echo shar: \"'examples/waitforonline/lmkfile'\" unpacked with wrong size!
fi
# end of 'examples/waitforonline/lmkfile'
fi
if test -f 'examples/waitforonline/waitforonline.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'examples/waitforonline/waitforonline.c'\"
else
echo shar: Extracting \"'examples/waitforonline/waitforonline.c'\" \(996 characters\)
sed "s/^X//" >'examples/waitforonline/waitforonline.c' <<'END_OF_FILE'
X/*
X** $Id: waitforonline.c,v 1.2 91/11/13 11:15:04 dlarson Exp $
X**
X** SANA-II driver utility -- Wait for a driver to come online.
X** (No wait if driver already online.)
X**
X** Copyright 1991 Commodore-Amiga, Inc.
X**
X** This code may be modified and used freely on Amiga computers.
X**
X*/
X
X
X#define NOBUFFS 1
X#include "/skeleton/skeleton.h"
X
Xstruct MsgPort *DevPort = NULL;
Xstruct IOSana2Req *IOB1 = NULL;
X
Xint DeviceOpen = 0;
Xlong DevBits;
X
Xvoid WaitForOnLine();
X
Xmain(argc , argv)
Xchar *argv[];
X{
X if(!initdev())
X printf("Open Failed\n");
X else
X {
X printf("Waiting For OnLine\n");
X WaitForOnLine();
X if(IOB1->ios2_Req.io_Error)
X printf("ERROR CODE: 0x%lx\n",
X (long)IOB1->ios2_Req.io_Error);
X else
X printf("OnLine Occurred - No Error\n");
X }
Xbottom: closedev();
X}
X
Xvoid WaitForOnLine()
X{
X IOB1->ios2_Req.io_Error = 0;
X IOB1->ios2_Req.io_Flags = IOF_QUICK;
X IOB1->ios2_Req.io_Command = S2_ONEVENT;
X IOB1->ios2_WireError = S2EVENT_ONLINE;
X DoIO(IOB1);
X}
END_OF_FILE
if test 996 -ne `wc -c <'examples/waitforonline/waitforonline.c'`; then
echo shar: \"'examples/waitforonline/waitforonline.c'\" unpacked with wrong size!
fi
# end of 'examples/waitforonline/waitforonline.c'
fi
if test ! -d 'include' ; then
echo shar: Creating directory \"'include'\"
mkdir 'include'
fi
if test ! -d 'include/devices' ; then
echo shar: Creating directory \"'include/devices'\"
mkdir 'include/devices'
fi
if test -f 'include/devices/sana2.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'include/devices/sana2.h'\"
else
echo shar: Extracting \"'include/devices/sana2.h'\" \(7276 characters\)
sed "s/^X//" >'include/devices/sana2.h' <<'END_OF_FILE'
X#ifndef SANA2_SANA2DEVICE_H
X#define SANA2_SANA2DEVICE_H 1
X/*
X** $Id: sana2.h,v 1.4 91/11/07 11:34:41 dlarson Exp $
X**
X** Structure definitions for SANA-II devices.
X**
X** (C) Copyright 1991 Commodore-Amiga Inc.
X** All Rights Reserved
X*/
X
X
X#ifndef EXEC_TYPES_H
X#include <exec/types.h>
X#endif
X
X#ifndef EXEC_PORTS_H
X#include <exec/ports.h>
X#endif
X
X#ifndef EXEC_IO_H
X#include <exec/io.h>
X#endif
X
X#ifndef EXEC_ERRORS_H
X#include <exec/errors.h>
X#endif
X
X#ifndef DEVICES_TIMER_H
X#include <devices/timer.h>
X#endif
X
X#ifndef UTILITY_TAGITEM_H
X#include <utility/tagitem.h>
X#endif
X
X
X#define SANA2_MAX_ADDR_BITS (128)
X#define SANA2_MAX_ADDR_BYTES ((SANA2_MAX_ADDR_BITS+7)/8)
X
Xstruct IOSana2Req
X{
X struct IORequest ios2_Req;
X ULONG ios2_WireError; /* wire type specific error */
X ULONG ios2_PacketType; /* packet type */
X UBYTE ios2_SrcAddr[SANA2_MAX_ADDR_BYTES]; /* source addr */
X UBYTE ios2_DstAddr[SANA2_MAX_ADDR_BYTES]; /* dest address */
X ULONG ios2_DataLength; /* length of packet data */
X VOID *ios2_Data; /* packet data */
X VOID *ios2_StatData; /* statics data pointer */
X VOID *ios2_BufferManagement; /* see SANA-II OpenDevice adoc */
X};
X
X
X/*
X** defines for the ios2_Flags field
X*/
X#define SANA2IOB_RAW (7) /* raw packet IO requested */
X#define SANA2IOF_RAW (1<<SANA2IOB_RAW)
X
X#define SANA2IOB_BCAST (6) /* broadcast packet (received) */
X#define SANA2IOF_BCAST (1<<SANA2IOB_BCAST)
X
X#define SANA2IOB_MCAST (5) /* multicast packet (received) */
X#define SANA2IOF_MCAST (1<<SANA2IOB_MCAST)
X
X#define SANA2IOB_QUICK (IOB_QUICK) /* quick IO requested (0) */
X#define SANA2IOF_QUICK (IOF_QUICK)
X
X
X/*
X** defines for OpenDevice() flags
X*/
X#define SANA2OPB_MINE (0) /* exclusive access requested */
X#define SANA2OPF_MINE (1<<SANA2OPB_MINE)
X
X#define SANA2OPB_PROM (1) /* promiscuous mode requested */
X#define SANA2OPF_PROM (1<<SANA2OPB_PROM)
X
X
X/*
X** defines for OpenDevice() tags
X*/
X#define S2_Dummy (TAG_USER + 0xB0000)
X
X#define S2_CopyToBuff (S2_Dummy + 1)
X#define S2_CopyFromBuff (S2_Dummy + 2)
X
X
Xstruct Sana2DeviceQuery
X{
X/*
X** Standard information
X*/
X ULONG SizeAvailable; /* bytes available */
X ULONG SizeSupplied; /* bytes supplied */
X ULONG DevQueryFormat; /* this is type 0 */
X ULONG DeviceLevel; /* this document is level 0 */
X/*
X** Common information
X*/
X UWORD AddrFieldSize; /* address size in bits */
X ULONG MTU; /* maximum packet data size */
X ULONG BPS; /* line rate (bits/sec) */
X ULONG HardwareType; /* what the wire is */
X/*
X** Format specific information
X*/
X};
X
X
X/*
X** defined Hardware types
X**
X** If your hardware type isn't listed below contact CATS to get a new
X** type number added for your hardware.
X*/
X
X#define S2WireType_Ethernet 1
X#define S2WireType_IEEE802 6
X#define S2WireType_Arcnet 7
X#define S2WireType_LocalTalk 11
X
X#define S2WireType_PPP 253
X#define S2WireType_SLIP 254
X#define S2WireType_CSLIP 255
X
X
Xstruct Sana2PacketTypeStats
X{
X ULONG PacketsSent; /* transmitted count */
X ULONG PacketsReceived; /* received count */
X ULONG BytesSent; /* bytes transmitted count */
X ULONG BytesReceived; /* bytes received count */
X ULONG PacketsDropped; /* packets dropped count */
X};
X
X
Xstruct Sana2SpecialStatRecord
X{
X ULONG Type; /* statistic identifier */
X ULONG Count; /* the statistic */
X char *String; /* statistic name */
X};
X
X
Xstruct Sana2SpecialStatHeader
X{
X ULONG RecordCountMax; /* room available */
X ULONG RecordCountSupplied; /* number supplied */
X /* struct Sana2SpecialStatRecord[RecordCountMax]; */
X};
X
X
Xstruct Sana2DeviceStats
X{
X ULONG PacketsReceived; /* received count */
X ULONG PacketsSent; /* transmitted count */
X ULONG BadData; /* bad packets received */
X ULONG Overruns; /* hardware miss count */
X ULONG UnknownTypesReceived; /* orphan count */
X ULONG Reconfigurations; /* network reconfigurations */
X struct timeval LastStart; /* time of last online */
X};
X
X
X/*
X** Device Commands
X*/
X#define S2_START (CMD_NONSTD)
X
X#define S2_DEVICEQUERY (S2_START+ 0)
X#define S2_GETSTATIONADDRESS (S2_START+ 1)
X#define S2_CONFIGINTERFACE (S2_START+ 2)
X#define S2_ADDSTATIONALIAS (S2_START+ 3)
X#define S2_DELSTATIONALIAS (S2_START+ 4)
X#define S2_ADDMULTICASTADDRESS (S2_START+ 5)
X#define S2_DELMULTICASTADDRESS (S2_START+ 6)
X#define S2_MULTICAST (S2_START+ 7)
X#define S2_BROADCAST (S2_START+ 8)
X#define S2_TRACKTYPE (S2_START+ 9)
X#define S2_UNTRACKTYPE (S2_START+10)
X#define S2_GETTYPESTATS (S2_START+11)
X#define S2_GETSPECIALSTATS (S2_START+12)
X#define S2_GETGLOBALSTATS (S2_START+13)
X#define S2_ONEVENT (S2_START+14)
X#define S2_READORPHAN (S2_START+15)
X#define S2_ONLINE (S2_START+16)
X#define S2_OFFLINE (S2_START+17)
X
X#define S2_END (S2_START+18)
X
X
X/*
X** defined errors for ios2_Error (see also <exec/errors.h>)
X*/
X#define S2ERR_NO_ERROR 0 /* peachy-keen */
X#define S2ERR_NO_RESOURCES 1 /* resource allocation failure */
X#define S2ERR_BAD_ARGUMENT 3 /* garbage somewhere */
X#define S2ERR_BAD_STATE 4 /* inappropriate state */
X#define S2ERR_BAD_ADDRESS 5 /* who? */
X#define S2ERR_MTU_EXCEEDED 6 /* too much to chew */
X#define S2ERR_NOT_SUPPORTED 8 /* hardware can't support cmd */
X#define S2ERR_SOFTWARE 9 /* software error detected */
X#define S2ERR_OUTOFSERVICE 10 /* driver is OFFLINE */
X/*
X** From <exec/errors.h>
X**
X** IOERR_OPENFAIL (-1) * device/unit failed to open *
X** IOERR_ABORTED (-2) * request terminated early [after AbortIO()] *
X** IOERR_NOCMD (-3) * command not supported by device *
X** IOERR_BADLENGTH (-4) * not a valid length (usually IO_LENGTH) *
X** IOERR_BADADDRESS (-5) * invalid address (misaligned or bad range) *
X** IOERR_UNITBUSY (-6) * device opens ok, but requested unit is busy *
X** IOERR_SELFTEST (-7) * hardware failed self-test *
X*/
X
X/*
X** defined errors for ios2_WireError
X*/
X#define S2WERR_GENERIC_ERROR 0 /* no specific info available */
X#define S2WERR_NOT_CONFIGURED 1 /* unit not configured */
X#define S2WERR_UNIT_ONLINE 2 /* unit is currently online */
X#define S2WERR_UNIT_OFFLINE 3 /* unit is currently offline */
X#define S2WERR_ALREADY_TRACKED 4 /* protocol already tracked */
X#define S2WERR_NOT_TRACKED 5 /* protocol not tracked */
X#define S2WERR_BUFF_ERROR 6 /* buff mgt func returned error */
X#define S2WERR_SRC_ADDRESS 7 /* source address problem */
X#define S2WERR_DST_ADDRESS 8 /* destination address problem */
X#define S2WERR_BAD_BROADCAST 9 /* broadcast address problem */
X#define S2WERR_BAD_MULTICAST 10 /* multicast address problem */
X#define S2WERR_MULTICAST_FULL 11 /* multicast address list full */
X#define S2WERR_BAD_EVENT 12 /* unsupported event class */
X#define S2WERR_BAD_STATDATA 13 /* statdata failed sanity check */
X#define S2WERR_IS_CONFIGURED 15 /* attempt to config twice */
X#define S2WERR_NULL_POINTER 16 /* null pointer detected */
X
X
X/*
X** defined events
X*/
X#define S2EVENT_ERROR (1L<<0) /* error catch all */
X#define S2EVENT_TX (1L<<1) /* transmitter error catch all */
X#define S2EVENT_RX (1L<<2) /* receiver error catch all */
X#define S2EVENT_ONLINE (1L<<3) /* unit is in service */
X#define S2EVENT_OFFLINE (1L<<4) /* unit is not in service */
X#define S2EVENT_BUFF (1L<<5) /* buff mgt function error */
X#define S2EVENT_HARDWARE (1L<<6) /* hardware error catch all */
X#define S2EVENT_SOFTWARE (1L<<7) /* software error catch all */
X
X
X#endif /* SANA2_SANA2DEVICE_H */
END_OF_FILE
if test 7276 -ne `wc -c <'include/devices/sana2.h'`; then
echo shar: \"'include/devices/sana2.h'\" unpacked with wrong size!
fi
# end of 'include/devices/sana2.h'
fi
if test -f 'include/devices/sana2.i' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'include/devices/sana2.i'\"
else
echo shar: Extracting \"'include/devices/sana2.i'\" \(7920 characters\)
sed "s/^X//" >'include/devices/sana2.i' <<'END_OF_FILE'
X IFND SANA2_SANA2DEVICE_I
XSANA2_SANA2DEVICE_I SET 1
X**
X** $Id: sana2.i,v 1.7 91/11/12 14:24:45 dlarson Exp $
X**
X** Structure definitions for SANA-II devices.
X**
X** (C) Copyright 1991 Commodore-Amiga Inc.
X** All Rights Reserved
X**
X
X
X IFND EXEC_TYPES_I
X INCLUDE "exec/types.i"
X ENDC
X
X IFND EXEC_PORTS_I
X INCLUDE "exec/ports.i"
X ENDC
X
X IFND EXEC_IO_I
X INCLUDE "exec/io.i"
X ENDC
X
X IFND EXEC_ERRORS_I
X INCLUDE "exec/errors.i"
X ENDC
X
X IFND DEVICES_TIMER_I
X INCLUDE "devices/timer.i"
X ENDC
X
X IFND UTILITY_TAGITEM_I
X INCLUDE "utility/tagitem.i"
X ENDC
X
X
XSANA2_MAX_ADDR_BITS EQU 128
XSANA2_MAX_ADDR_BYTES EQU ((SANA2_MAX_ADDR_BITS+7)/8)
X
X
X STRUCTURE IOSana2Req,0
X STRUCT IOS2_REQ,IO_SIZE
X ULONG IOS2_WIREERROR ; wire type specific error
X ULONG IOS2_PACKETTYPE ; packet type
X STRUCT IOS2_SRCADDR,SANA2_MAX_ADDR_BYTES ; source address
X STRUCT IOS2_DSTADDR,SANA2_MAX_ADDR_BYTES ; dest address
X ULONG IOS2_DATALENGTH ; length of packet data
X APTR IOS2_DATA ; packet data (not touched by driver!)
X APTR IOS2_STATDATA ; statics data pointer
X APTR IOS2_BUFFERMANAGEMENT ; see SANA-II OpenDevice adoc
X
X LABEL IOS2_SIZE
X
X
X;
X; equates for the IOS2_FLAGS field
X;
X
XSANA2IOB_RAW EQU 7 ; raw packet IO requested
XSANA2IOF_RAW EQU (1<<SANA2IOB_RAW)
X
XSANA2IOB_BCAST EQU 6 ; broadcast packet (received)
XSANA2IOF_BCAST EQU (1<<SANA2IOB_BCAST)
X
XSANA2IOB_MCAST EQU 5 ; multicast packet (received)
XSANA2IOF_MCAST EQU (1<<SANA2IOB_MCAST)
X
XSANA2IOB_QUICK EQU IOB_QUICK ; quick IO requested (0)
XSANA2IOF_QUICK EQU IOF_QUICK
X
X
X;
X; equates for OpenDevice()
X;
X
XSANA2OPB_MINE EQU 0 ; exclusive access requested
XSANA2OPF_MINE EQU (1<<SANA2OPB_MINE)
X
XSANA2OPB_PROM EQU 1 ; promiscuous mode requested
XSANA2OPF_PROM EQU (1<<SANA2OPB_PROM)
X
XS2_Dummy EQU (TAG_USER+$B0000)
XS2_COPYTOBUFF EQU S2_Dummy+1
XS2_COPYFROMBUFF EQU S2_Dummy+2
X
X STRUCTURE SANA2DEVICEQUERY,0
X ; Standard information
X ULONG S2DQ_SIZEAVAILABLE ; bytes available
X ULONG S2DQ_SIZESUPPLIED ; bytes supplied
X ULONG S2DQ_FORMAT ; this is type 0
X ULONG S2DQ_DEVICELEVEL ; this document is level 0
X
X ; Common information
X UWORD S2DQ_ADDRFIELDSIZE ; address size in bits
X ULONG S2DQ_MTU ; maximum packet data size
X ULONG S2DQ_BPS ; line rate (bits/sec)
X ULONG S2DQ_HARDWARETYPE ; what the wire is
X
X ; Format specific information
X LABEL S2DQ_SIZE
X
X
X;
X; defined SANA-II hardware types
X;
X
XS2WIRETYPE_ETHERNET EQU 1
XS2WIRETYPE_IEEE802 EQU 6
XS2WIRETYPE_ARCNET EQU 7
XS2WIRETYPE_LOCALTALK EQU 11
X
XS2WIRETYPE_PPP EQU 253
XS2WIRETYPE_SLIP EQU 254
XS2WIRETYPE_CSLIP EQU 255
X
X
X STRUCTURE SANA2PACKETTYPESTATS,0
X ULONG S2PTS_TXPACKETS ; transmitted count
X ULONG S2PTS_RXPACKETS ; received count
X ULONG S2PTS_TXBYTES ; bytes transmitted count
X ULONG S2PTS_RXBYTES ; bytes received count
X ULONG S2PTS_PACKETSDROPPED ; packets dropped count
X LABEL S2PTS_SIZE
X
X
X STRUCTURE SANA2SPECIALSTATRECORD,0
X ULONG S2SSR_TYPE ; statistic identifier
X ULONG S2SSR_COUNT ; the statistic
X APTR S2SSR_STRING ; statistic name
X LABEL S2SSR_SIZE
X
X
X STRUCTURE SANA2SPECIALSTATHEADER,0
X ULONG S2SSH_RECORDCOUNTMAX ; room available
X ULONG S2SSH_RECORDCOUNTSUPPLIED ; number supplied
X LABEL S2SSH_SIZE
X
X
X STRUCTURE SANA2DEVICESTATS,0
X ULONG S2DS_PACKETSRECEIVED ; received count
X ULONG S2DS_PACKETSSENT ; transmitted count
X ULONG S2DS_BADDATA ; bad packets received
X ULONG S2DS_OVERRUNS ; hardware miss count
X ULONG S2DS_SOFTMISSES ; software miss count
X ULONG S2DS_UNKNOWNTYPESRECEIVED ; orphan count
X ULONG S2DS_RECONFIGURATIONS ; network reconfigurations
X STRUCT S2DS_LASTSTART,TV_SIZE ; time of last online
X LABEL S2DS_SIZE
X
X
X;
X; Device Commands
X;
X
XS2_START EQU (CMD_NONSTD)
X
XS2_DEVICEQUERY EQU (S2_START+0)
XS2_GETSTATIONADDRESS EQU (S2_START+1)
XS2_CONFIGINTERFACE EQU (S2_START+2)
XS2_ADDSTATIONALIAS EQU (S2_START+3)
XS2_DELSTATIONALIAS EQU (S2_START+4)
XS2_ADDMULTICASTADDRESS EQU (S2_START+5)
XS2_DELMULTICASTADDRESS EQU (S2_START+6)
XS2_MULTICAST EQU (S2_START+7)
XS2_BROADCAST EQU (S2_START+8)
XS2_TRACKTYPE EQU (S2_START+9)
XS2_UNTRACKTYPE EQU (S2_START+10)
XS2_GETTYPESTATS EQU (S2_START+11)
XS2_GETSPECIALSTATS EQU (S2_START+12)
XS2_GETGLOBALSTATS EQU (S2_START+13)
XS2_ONEVENT EQU (S2_START+14)
XS2_READORPHAN EQU (S2_START+15)
XS2_ONLINE EQU (S2_START+16)
XS2_OFFLINE EQU (S2_START+17)
X
XS2_END EQU (S2_START+18)
X
X
X;
X; defined errors for IOS2_ERROR
X;
X
XS2ERR_NO_ERROR EQU 0 ; peachy-keen
XS2ERR_NO_RESOURCES EQU 1 ; resource allocation failure
XS2ERR_BAD_ARGUMENT EQU 3 ; garbage somewhere
XS2ERR_BAD_STATE EQU 4 ; inappropriate state
XS2ERR_BAD_ADDRESS EQU 5 ; who?
XS2ERR_MTU_EXCEEDED EQU 6 ; too much to chew
XS2ERR_NOT_SUPPORTED EQU 8 ; command not supported by hardware
XS2ERR_SOFTWARE EQU 9 ; software error detected
XS2ERR_OUTOFSERVICE EQU 10 ; driver is offline
X;SEE ALSO <exec/errors.i>
X
X;
X; defined errors for IOS2_WIREERROR
X;
X
XS2WERR_GENERIC_ERROR EQU 0 ; no specific info available
XS2WERR_NOT_CONFIGURED EQU 1 ; unit not configured
XS2WERR_UNIT_ONLINE EQU 2 ; unit is currently online
XS2WERR_UNIT_OFFLINE EQU 3 ; unit is currently offline
XS2WERR_ALREADY_TRACKED EQU 4 ; protocol already tracked
XS2WERR_NOT_TRACKED EQU 5 ; protocol not tracked
XS2WERR_BUFF_ERROR EQU 6 ; buffer mgmt func returned error
XS2WERR_SRC_ADDRESS EQU 7 ; source address problem
XS2WERR_DST_ADDRESS EQU 8 ; destination address problem
XS2WERR_BAD_BROADCAST EQU 9 ; broadcast address problem
XS2WERR_BAD_MULTICAST EQU 10 ; multicast address problem
XS2WERR_MULTICAST_FULL EQU 11 ; multicast address list full
XS2WERR_BAD_EVENT EQU 12 ; unsupported event class
XS2WERR_BAD_STATDATA EQU 13 ; statdata failed sanity check
XS2WERR_IS_CONFIGURED EQU 15 ; attempt to config twice
XS2WERR_NULL_POINTER EQU 16 ; null pointer detected
X
X
X;
X; defined events
X;
X
XS2EVENT_ERROR equ 1 ; error catch all
XS2EVENT_TX equ 2 ; transmitter error catch all
XS2EVENT_RX equ 4 ; receiver error catch all
XS2EVENT_ONLINE equ 8 ; unit is in service
XS2EVENT_OFFLINE equ 16 ; unit is not in service
XS2EVENT_BUFF equ 32 ; buffer mgmt function error catch all
XS2EVENT_HARDWARE equ 64 ; hardware error catch all
XS2EVENT_SOFTWARE equ 128 ; software error catch all
X
X
X ENDC SANA2_SANA2DEVICE_I
END_OF_FILE
if test 7920 -ne `wc -c <'include/devices/sana2.i'`; then
echo shar: \"'include/devices/sana2.i'\" unpacked with wrong size!
fi
# end of 'include/devices/sana2.i'
fi
if test -f 'include/devices/sana2specialstats.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'include/devices/sana2specialstats.h'\"
else
echo shar: Extracting \"'include/devices/sana2specialstats.h'\" \(1206 characters\)
sed "s/^X//" >'include/devices/sana2specialstats.h' <<'END_OF_FILE'
X#ifndef SANA2_SANA2SPECIALSTATS_H
X#define SANA2_SANA2SPECIALSTATS_H 1
X/*
X** $Id: sana2specialstats.h,v 1.2 91/10/17 12:59:47 dlarson Exp $
X**
X** Defined ids for SANA-II special statistics.
X**
X**
X** (C) Copyright 1991 Commodore-Amiga Inc.
X** All Rights Reserved
X*/
X
X
X#ifndef SANA2_SANA2DEVICE_H
X#include <sana2/sana2device.h>
X#endif /* !SANA2_SANA2DEVICE_H */
X
X
X/*
X** The SANA-II special statistic identifier is an unsigned 32 number.
X** The upper 16 bits identify the type of network wire type to which
X** the statistic applies and the lower 16 bits identify the particular
X** statistic.
X**
X** If you desire to add a new statistic identifier, contacts CATS.
X*/
X
X
X
X/*
X** defined ethernet special statistics
X*/
X
X#define S2SS_ETHERNET_BADMULTICAST ((((S2WireType_Ethernet)&0xffff)<<16)|0x0000)
X/*
X** This count will record the number of times a received packet tripped
X** the hardware's multicast filtering mechanism but was not actually in
X** the current multicast table.
X*/
X
X#define S2SS_ETHERNET_RETRIES ((((S2WireType_Ethernet)&0xffff)<<16)|0x0001)
X/*
X** This count records the total number of retries which have resulted
X** from transmissions on this board.
X*/
X
X
X#endif /* SANA2_SANA2SPECIALSTATS_H */
END_OF_FILE
if test 1206 -ne `wc -c <'include/devices/sana2specialstats.h'`; then
echo shar: \"'include/devices/sana2specialstats.h'\" unpacked with wrong size!
fi
# end of 'include/devices/sana2specialstats.h'
fi
if test -f 'include/devices/sana2specialstats.i' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'include/devices/sana2specialstats.i'\"
else
echo shar: Extracting \"'include/devices/sana2specialstats.i'\" \(1146 characters\)
sed "s/^X//" >'include/devices/sana2specialstats.i' <<'END_OF_FILE'
X IFND SANA2_SANA2SPECIALSTATS_I
XSANA2_SANA2SPECIALSTATS_I SET 1
X**
X** $Id: sana2specialstats.i,v 1.2 91/10/17 12:59:56 dlarson Exp $
X**
X** Defined ids for SANA-II special statistics.
X**
X**
X** (C) Copyright 1991 Commodore-Amiga Inc.
X** All Rights Reserved
X**
X
X
X IFND SANA2_SANA2DEVICE_I
X INCLUDE "sana2/sana2device.i"
X ENDC !SANA2_SANA2DEVICE_I
X
X;
X; The SANA-II special statistic identifier is an unsigned 32 number.
X; The upper 16 bits identify the type of network wire type to which
X; the statistic applies and the lower 16 bits identify the particular
X; statistic.
X;
X
X; If you'd like to add new statistic identifiers, contact CATS.
X
X;
X; defined ethernet special statistics
X;
X
XS2SS_ETHERNET_BADMULTICAST EQU ((((S2WIRETYPE_ETHERNET)&$ffff)<<16)|$0000)
X;
X; This count will record the number of times a received packet tripped
X; the hardware's multicast filtering mechanism but was not actually in
X; the current multicast table.
X;
X
XS2SS_ETHERNET_RETRIES EQU ((((S2WIRETYPE_ETHERNET)&$ffff)<<16)|$0001)
X;
X; This count records the total number of retries which have resulted
X; from transmissions on this board.
X;
X
X
X ENDC SANA2_SANA2SPECIALSTATS_I
END_OF_FILE
if test 1146 -ne `wc -c <'include/devices/sana2specialstats.i'`; then
echo shar: \"'include/devices/sana2specialstats.i'\" unpacked with wrong size!
fi
# end of 'include/devices/sana2specialstats.i'
fi
if test -f 'readme' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'readme'\"
else
echo shar: Extracting \"'readme'\" \(1031 characters\)
sed "s/^X//" >'readme' <<'END_OF_FILE'
XThis distribution contains the SANA-II Network Device Driver Specification,
Xversion of November 7, 1991, for final comment and approval. This means
Xthat no additional changes are expected and that only compelling objections
Xwill keep this version of the spec from becoming final on January 1, 1991.
X
XThis distribution also contains supporting materials in the form of some
Xexample code. More example code, including a skeleton SANA-II device
Xdriver, are planned for the near future.
X
XFinally, so that you can actually use this now to develop network protocols,
Xa beta binary of our A2065 ethernet driver is included.
X
X
XFILES
X
X README - this file.
X driver.txt - text of driver specification.
X sana2driver.doc - autodoc for driver specification.
X copybuff.doc - autodoc for buffer management functions in spec.
X
X devs/a2065.device - *beta* version of Commodore ethernet driver.
X (also works with Ameristar ethernet boards)
X
X plus include files for the specification in "include/devices"
X plus example programs in "examples"
END_OF_FILE
if test 1031 -ne `wc -c <'readme'`; then
echo shar: \"'readme'\" unpacked with wrong size!
fi
# end of 'readme'
fi
echo shar: End of archive 1 \(of 4\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 4 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 4 archives.
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
--
Mail submissions (sources or binaries) to <amiga@uunet.uu.net>.
Mail comments to the moderator at <amiga-request@uunet.uu.net>.
Post requests for sources, and general discussion to comp.sys.amiga.misc.